package com.woniuxy.coder;


import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

import org.json.JSONException;
import org.json.JSONObject;

import com.woniuxy.pojo.Order_dgy;

/**
 * 编码器
 * @author 邓国誉
 *
 */
public class OrderEncoder implements Encoder.Text<Order_dgy>{

	@Override
	public void destroy() {
		
	}

	@Override
	public void init(EndpointConfig arg0) {
		
	}

	@Override
	public String encode(Order_dgy order) throws EncodeException {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("order_dgy", order);
		} catch (JSONException e) {
			e.printStackTrace();
		}	
		return jsonObject.toString();
	}

}